<template>
  <div class="find-house-container">
    <h2>找房列表</h2>
    <div class="house-list">
      <div class="house-item" v-for="house in houseList" :key="house.id" @click="goToHouseDetail(house.id)">
        <div class="house-info">
          <p class="house-title">{{ house.title }}</p>
          <p class="house-price">{{ house.price }} 元/月</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "FindHouse",
  data() {
    return {
      houseList: [
        {
          id: 1,
          title: "金沙雅苑(二期) 一室",
          price: 111,
          image: "https://via.placeholder.com/100",
        },
        {
          id: 2,
          title: "宜居生活 两室",
          price: 1234,
          image: "https://via.placeholder.com/100",
        },
      ],
    };
  },
  methods: {
    goToHouseDetail(id) {
      this.$router.push({ name: 'HouseContainer', params: { id } }); // 跳转到房源详情页
    },
  },
};
</script>

<style scoped>

/* 移除搜索栏的样式，保留找房页面的独特样式 */
.house-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.house-item {
  display: flex;
  padding: 10px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}
</style>
